<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<title>Search status</title>
</h:head>
<body>

	<h:form id="criteriaForm">
		<p:growl id="msgs" showDetail="true" />
		<h:panelGrid columns="3" cellpadding="3" cellspacing="2">

			<h:outputLabel for="id" value="Id:" />
			<p:selectBooleanCheckbox value="#{selectBooleanView.value1}">
				<p:ajax update="id" />
			</p:selectBooleanCheckbox>
			<p:inputText id="id" value="#{adminSelectedInput.companySiteId}"
				disabled="#{!selectBooleanView.value1}" />

			<p:outputLabel for="eventtime" value="Event time:" />
			<p:selectBooleanCheckbox value="#{selectBooleanView.value2}">
				<p:ajax update="eventtime" />
			</p:selectBooleanCheckbox>
			<p:calendar id="eventtime" value="#{adminSelectedInput.eventTime}"
				pattern="MM/dd/yyyy HH:mm:ss"
				disabled="#{!selectBooleanView.value2}" />
				
				<h:outputLabel for="system" value="System:" />
			<p:selectBooleanCheckbox value="#{selectBooleanView.value3}">
				<p:ajax update="system" />
			</p:selectBooleanCheckbox>
			<p:inputText id="system" value="#{adminSelectedInput.system}"
				disabled="#{!selectBooleanView.value3}" />
				
				<h:outputLabel for="subsystem" value="Subsystem:" />
			<p:selectBooleanCheckbox value="#{selectBooleanView.value4}">
				<p:ajax update="subsystem" />
			</p:selectBooleanCheckbox>
			<p:inputText id="subsystem" value="#{adminSelectedInput.subSystem}"
				disabled="#{!selectBooleanView.value4}" />
				
				<h:outputLabel for="status" value="Status:" />
			<p:selectBooleanCheckbox value="#{selectBooleanView.value5}">
				<p:ajax update="status" />
			</p:selectBooleanCheckbox>
			<p:inputText id="status" value="#{adminSelectedInput.status}"
				disabled="#{!selectBooleanView.value5}" />
				
				<h:outputLabel for="statusMessage" value="Status Message:" />
			<p:selectBooleanCheckbox value="#{selectBooleanView.value6}">
				<p:ajax update="statusMessage" />
			</p:selectBooleanCheckbox>
			<p:inputText id="statusMessage" value="#{adminSelectedInput.statusMsg}"
				disabled="#{!selectBooleanView.value6}" />

			<p:outputLabel for="starttime" value="Start time:" />
			<p:selectBooleanCheckbox value="#{selectBooleanView.value7}">
				<p:ajax update="starttime" />
			</p:selectBooleanCheckbox>
			<p:calendar id="starttime" value="#{adminSelectedInput.startTime}"
				pattern="MM/dd/yyyy HH:mm:ss"
				disabled="#{!selectBooleanView.value7}" />

			<p:outputLabel for="endtime" value="End time:" />
			<p:selectBooleanCheckbox value="#{selectBooleanView.value8}">
				<p:ajax update="endtime" />
			</p:selectBooleanCheckbox>
			<p:calendar id="endtime" value="#{adminSelectedInput.endTime}"
				pattern="MM/dd/yyyy HH:mm:ss"
				disabled="#{!selectBooleanView.value8}" />

		</h:panelGrid>
	</h:form>


	<h:form>
		<h:panelGrid columns="3">
			<h:outputText value="Keyup: " />
			<p:inputText id="counter" value="#{listenerView.text}">
				<p:ajax event="keyup" update="dataTable"
					listener="#{listenerView.handleKeyEvent}" />
			</p:inputText>
		</h:panelGrid>
		<p:commandButton value="Display"
			action="#{sjmDao.findByStatus(listenerView.text)}" update="dataTable" />

		<p:dataTable id="dataTable" var="subSystemStatus"
			value="#{sjmDao.listSubSystemStatus}">
			<p:column headerText="ID">
				<h:outputText value="#{subSystemStatus.companySiteId}" />
			</p:column>

			<p:column headerText="event Date">
				<h:outputText value="#{subSystemStatus.eventDate}" />
			</p:column>

			<p:column headerText="System">
				<h:outputText value="#{subSystemStatus.system}" />
			</p:column>

			<p:column headerText="Subsystem">
				<h:outputText value="#{subSystemStatus.subSystem}" />
			</p:column>

			<p:column headerText="Status">
				<h:outputText value="#{subSystemStatus.status}" />
			</p:column>

			<p:column headerText="Status Message">
				<h:outputText value="#{subSystemStatus.statusMsg}" />
			</p:column>

			<p:column headerText="Start time">
				<h:outputText value="#{subSystemStatus.startTime}" />
			</p:column>

			<p:column headerText="End time">
				<h:outputText value="#{subSystemStatus.endTime}" />
			</p:column>

		</p:dataTable>

	</h:form>
</body>
</html>
